/*****************************************************************************
* Keppe Messenger (KMP) Keppe Project-Team User Messaging System
* Copyright (C) 2013-2014 Keppe Project-Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/

#ifndef FRMCHAT_H
#define FRMCHAT_H

#include <QDialog>
#include <QLineEdit>
#include <QSettings>
#include "frmLogin.h"
#include "config.h"

namespace Ui {
class frmChat;
}

class frmChat : public QDialog
{
    Q_OBJECT
    
public:
    explicit frmChat(QWidget *parent = 0);
    void setChatter(QString username, QString nickname, QString userstate, QString mynick, QString stateImage, int onlinestate, QString avatarImage, bool reloadConf = false);
    void setForm(frmLogin* login);
    void setChatFocus();
    void appendTextToLineEdit(QLineEdit* lineedit,QString text);
    void incomingMessage(QString message);
    void sendMessage();
    void setWidgetDesign();
    QString getChatTime();
    QString convertMessage(QString message);
    ~frmChat();

private slots:
    void automaticLength();
    void closeEvent(QCloseEvent *);
    void on_txtMessageBox_returnPressed();
    void on_cmdSmiley_clicked();
    void addEvilSmiley();
    void addFriendlySmiley();
    void addWinkSmiley();
    void addLaughtingSmiley();
    void addHahaSmiley();
    void addSurprisedSmiley();
    void addNormalSmiley();
    void addSadSmiley();
    void addAngrySmiley();
    void addCrySmiley();
    void openLink(QString url);
    void on_tbChat_sourceChanged(const QUrl &arg1);
    void scrollDown();
    void on_cmdSmiley_mouseRelease(QMouseEvent *);

private:
    Ui::frmChat *ui;
    int oldValue;
    int cultid;
    QObject *form;
    QString cuname;
    QString cunick;
    QString culast;
    QString cuavri;
    QString mynick;
    QString msglog;
    QSettings* msgs;


protected:
    void resizeEvent(QResizeEvent *ev);
};

#endif // FRMCHAT_H
